<?php

namespace App\Models\cainiao;

use App\Models\base\CurrencyModel;
use App\Models\CountryModel;
use App\Models\customer\NodeModel;
use App\Models\CustomerModel;
use App\Models\TakeOrderModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model as BaseModel;


class AsnModel extends BaseModel
{
    use SoftDeletes;
    protected $table = 't_cainiao_asn';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    const GOODS_ATTR = [
        'normal' => 1,
        'special' => 2
    ];

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];

    //目的地国家
    public function destination(): BelongsTo {
        return $this->belongsTo(CountryModel::class, 'des_country_id');
    }

    //大包
    public function notify(): BelongsTo {
        return $this->belongsTo(NotifyModel::class, 'bigBagID', 'bigBagID');
    }

    //大客户
    public function customer(): BelongsTo {
        return $this->belongsTo(CustomerModel::class, 'customer_id');
    }
    //提单
    public function take_order(): BelongsTo {
        return $this->belongsTo(TakeOrderModel::class, 'take_order_id');
    }

    //币种
    public function currency(): BelongsTo {
        return $this->belongsTo(CurrencyModel::class, 'currency_id');
    }

    //系统节点
    public function system_node(): BelongsTo {
        return $this->belongsTo(NodeModel::class, 'system_node_id');
    }

    //平台节点
    public function platform_node(): BelongsTo {
        return $this->belongsTo(NodeModel::class, 'platform_node_id');
    }



}
